const palyerAction = process.argv[process.argv.length-1];

console.log(palyerAction);

if(palyerAction !=='rock' && palyerAction !=='paper' && palyerAction !=='scissor'){
    console.log('请输入 rock、paper、scissor');
}else{
    const arr =['rock','paper','scissor']
    const index =Math.floor(Math.random()*3)
    const computerAction = arr[index]
    console.log('你出的是'+palyerAction);
    console.log('电脑出的是'+computerAction);
    if(palyerAction === computerAction){
        console.log('平局');
    }else if(
        (palyerAction === 'rock' && computerAction === 'paper') ||
        (palyerAction === 'paper' && computerAction === 'scissor') ||
        (palyerAction === 'scissor' && computerAction === 'rock')
    ){
        console.log('你输了');
    }else{
        console.log('你赢了');
    }
}